<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/21 0021
 * Time: 16:06
 */

namespace app\sample\controller;

use think\Request;

class Test
{
//http://localhost:90/zerg/public/index.php/sample/test/hello
//http://localhost:90/zerg/public/index.php?s=sample/test/hello
//E:\phpStudy\Apache\conf\extra         httpd-vhosts.conf
//C:\Windows\System32\drivers\etc       hosts
//http://z.cn/zerg/public/index.php/hello
    public function hello(Request $request){//Request $request
        /*方法一。参数 $id, $name
         * echo $id;
        echo '|';
        echo $name;*/
        /*方法二。$id = Request::instance()->param('id');
        $name = Request::instance()->param('name');
        $age = Request::instance()->param('age');
        echo $id;
        echo '|';
        echo $name;
        echo '|';
        echo $age;*/
//        $all = Request::instance()->param();//1获取所有参数
//                $all = Request::instance()->get();// 获取url上的参数
//        $all = Request::instance()->route();// 获取路径上的参数
//        $all = Request::instance()->post();// 获取post的参数
//        $all = input('param.');//2
        /*方法三。参数 Request $request*/
        $all = $request->param();//3.通过参数
//        $all = input('param.');
//        $all = input('param.name');
//        $all = input('get.age');

        var_dump($all);
//        echo json_encode($all);
//        $all = $request->param();
//        $name = Request::instance()->param('name');
//        $age = Request::instance()->param('age');
//        var_dump($all);
        return 'hello, shenjiani!';
    }
}